﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using DevExpress.UserSkins;
using DevExpress.Skins;
using DevExpress.LookAndFeel;
using MMO_MANAGER.FORM_CATALOG;
using MMO_MANAGER.DAO;
using System.IO;
using System.Data.SQLite;
using MMO_MANAGER.Utils;

namespace MMO_MANAGER
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            
            if (!File.Exists(Application.StartupPath + @"\mmo.db"))
            {
                SQLiteConnection.CreateFile(Application.StartupPath + @"\mmo.db");
                SQLiteConnection conn = new SQLiteConnection("Data Source=mmo.db;");
                conn.Open();
                conn.ChangePassword(EasyEncoding.Descrypt("oWPweOjms9G41HuPQV8NibEdhRyuZGM45s10snhpzgQ=", "mahoa"));
                conn.Close();
                conn.Dispose();
                //conn.Cha
            }

            AccessData.GetPassDB();
            SqliteHelper sh = new SqliteHelper();
            sh.CreateTablechannel_list();
            sh.CreateTableemail_list();
            sh.CreateTablega_list();
            sh.CreateTablegpage_list();
            sh.CreateTablekeyword_list();
            sh.CreateTablelabel_list();
            sh.CreateTablenetwork_list();
            sh.CreateTableuser_list();
            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            BonusSkins.Register();
            SkinManager.EnableFormSkins();
            UserLookAndFeel.Default.SetSkinStyle("Office 2013");

            sh.InsertAdmin();

            Application.Run(new frmMain());
        }
    }
}
